package com.performax.database.Dao;

import java.util.*;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.performax.database.Vo.*;
import com.performax.database.oh2game.mapper.MyInfoMapper;

@Service(value = "oh2gameMypageDao")
public class Oh2GameMypageDao {
	
	@Resource(name = "myInfoMapper")
	private	MyInfoMapper myInfoMapper;
	
	public String getProfile(String userId){
		return this.myInfoMapper.getProfileImg(userId);
	}
	
	/*public List<NoticeInfoVo> getNoticeList(){
		return this.myInfoMapper.getNoticeList();
	}*/
	
	public void updateProfile(HashMap<String, Object>	param){
		this.myInfoMapper.updateProfile(param);	
	}
	
	public void removeProfile(String userId){
		this.myInfoMapper.deleteProfile(userId);
	}
	
	public List<EventInfoVo> getRegEventList(HashMap<String, Object> param){
		return this.myInfoMapper.getPreregInfo(param);
	}
	
	public int	getRegEventCount(String userId){
		return this.myInfoMapper.getPreregInfoCount(userId);
	}
	
	public List<BoardInfoVo> getMyBoardList(HashMap<String, Object> param){
		return this.myInfoMapper.getBoardList(param);
	}
	public List<BoardReplyInfoVo> getMyBoardReplyList(HashMap<String, Object> param){
		return this.myInfoMapper.getBoardReplyList(param);
	}
	public List<ReplyInfoVo> getMyEventReplyList(HashMap<String, Object> param){
		return this.myInfoMapper.getEventReplyList(param);
	}
	public int getMyBoardListCnt(String userId){
		return this.myInfoMapper.getBoardListCnt(userId);
	}
	public int getMyBoardReplyListCnt(String userId){
		return this.myInfoMapper.getBoardReplyListCnt(userId);
	}
	public int getMyEventReplyListCnt(String userId){
		return this.myInfoMapper.getEventReplyListCnt(userId);
	}
	
	public String updatePassword(HashMap<String, Object> param){
		String userId	=	this.myInfoMapper.getUserInfo(param);
		String	msg		=	"";	
		if(userId	==	null){
			msg	=	"wrong password";
		}else{
			if(userId.equals(param.get("userId"))){
				this.myInfoMapper.updatePassword(param);
				msg	=	"success";
			}else{
				msg	=	"wrong password";
			}
		}
		return msg;
	}
	
	public void updateGenre(HashMap<String, Object> param){
		this.myInfoMapper.updateGenre(param);
	}
	
	public String dropOut(HashMap<String, Object> param){
		String userId	=	this.myInfoMapper.getUserInfo(param);
		String	msg		=	"";	
		if(userId	==	null){
			msg	=	"wrong password";
		}else{
			if(userId.equals(param.get("userId"))){
				this.myInfoMapper.dropOut((String)param.get("userId"));
				this.myInfoMapper.setDropOutReason(param);
				msg	=	"success";
			}else{
				msg	=	"wrong password";
			}
		}
		return msg;
	}

	public String getCommFriendStatus(String userId){
		int	count	=	this.myInfoMapper.getCommFriendStatus(userId);
		String	status	=	"N";
		if(count	>	0){
			status	=	"Y";
		}
		return	status;
	}
	
	public List<EventFriendInfoVo> getEventFriendList(String userId){
		return this.myInfoMapper.getEventFriendList(userId);
	}
	
	public HashMap<String, Object> getAppInfo(){
		return this.myInfoMapper.getAppInfo();
	}
	
	public List<NoticeInfoVo> getNoticeList(HashMap<String, Object> param){
		return this.myInfoMapper.getNoticeList(param);
	}
	
	public int	getNoticeListCnt(HashMap<String, Object> param){
		return this.myInfoMapper.getNoticeListCnt(param);
	}
	
	public HashMap<String, Object> getPushSetting(HashMap<String, Object> param){
		return this.myInfoMapper.getPushSetting(param);
	}
	
	public void insertPushSetting(HashMap<String, Object> param){
		this.myInfoMapper.insertPushSetting(param);
	}
	
	public void updatePushSetting(HashMap<String, Object> param){
		this.myInfoMapper.updatePushSetting(param); 
	}
	
	
	public void logout(HashMap<String, Object> param){
		this.myInfoMapper.logOut(param);
	}
	
	public void regSnsInfo(HashMap<String, Object> param){
		int	count	=	this.myInfoMapper.getUserSnsCnt(param);
		
		if(count	>	0){
			this.myInfoMapper.updateUserSnsInfo(param);
		}else{
			this.myInfoMapper.insertUserSnsInfo(param);
		}
	}
	
	public List<UserSnsInfoVo> getUserSnsInfo(HashMap<String, Object> param){
		return this.myInfoMapper.getUserSnsInfo(param);
	}
	
}
